package com.cc.visitor.enums;

/**
 * @author chanchaw
 * @create 2024-11-30 15:40
 */
public enum QrUseType {
    FOLLOW(0,"关注用二维码","关注用二维码"),
    VISIT(1,"访单二维码","二维码内容是访单主键=visit.id"),
    URL(2,"用于跳转链接的二维码","用于跳转链接的二维码"),
    BROWSER_LOGIN(3,"浏览器登录用二维码","浏览器登录用二维码"),
    SECURITY(4,"门卫扫码用二维码","门卫扫码用二维码"),
    ;
    private int id;
    private String sid;
    private String remark;
    public int getId() {return id;}
    public String getSid() {return sid;}
    public String getRemark() {return remark;}

    QrUseType(int id, String sid, String remark) {
        this.id = id;
        this.sid = sid;
        this.remark = remark;
    }

    // 根据索引返回枚举值
    public static QrUseType ofid(int id){
        for(QrUseType item: QrUseType.values()){
            if(item.getId() == id) return item;
        }
        return null;
    }

    public static QrUseType ofsid(String sid){
        for(QrUseType item: QrUseType.values()){
            if(item.getSid().equals(sid)) return item;
        }
        return null;
    }
}
